#include <MultiplexD/MainThread.h>
#include <Ape/IO/Console.h>
#include <MultiplexD/DaemonInstance.h>

namespace MultiplexD {
	using Ape::String;
	using namespace Ape::Collections;
	
	MainThread::MainThread (int argc, char** argv)
			: m_CmdArgs(argc, L"")
	{
		for (int i = 0; i < argc; i++)
			m_CmdArgs[i] = argv[i];
	}
	MainThread::~MainThread() {
	}
	
	void MainThread::Run (Ape::EventModel::EventArgs& ea) {
		try {
			DaemonInstance::Get()->ReadConfiguration(m_CmdArgs);
			DaemonInstance::Get()->StartUp();
		}
		catch (Ape::Exception& exc) {
			exc._Dump (true);
		}
	}
	
}
